<template>
  <div class="refund">
    <div class="title">回款方式</div>
    <div class="content">
      <template v-if="isCompleteBoolean">
        <el-button type="primary" @click="handleComplete"> 扣&nbsp;&nbsp;&nbsp;&nbsp;息 </el-button>
      </template>
      <template v-else>
        <el-button type="primary" @click="handleComplete"> 全&nbsp;&nbsp;&nbsp;&nbsp;额 </el-button>
      </template>
      <template v-if="isBillingBoolean">
        <el-button type="primary" @click="handleBilling"> 不&nbsp;&nbsp;&nbsp;&nbsp;开 </el-button>
      </template>
      <template v-else>
        <el-button type="primary" @click="handleBilling"> 开&nbsp;&nbsp;&nbsp;&nbsp;票</el-button>
      </template>
    </div>
  </div>
</template>

<script setup lang="ts">
import { storeToRefs } from 'pinia' // 引入关键工具函数
import { tableDataStoreHook } from '@store/dataStore'

// 获取 store 实例
const tableDataStore = tableDataStoreHook()
const { isCompleteBoolean, isBillingBoolean } = storeToRefs(tableDataStore)
const handleComplete = () => {
  tableDataStore.handleComplete()
}
const handleBilling = () => {
  tableDataStore.handleBilling()
}
</script>

<style lang="scss" scoped>
.refund {
  padding: 10px;
  border: 1px solid #ccc;
  margin-bottom: 10px;
  .title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 10px;
  }
  .content {
    display: flex;
    align-items: center;
    justify-content: center;
  }
}
</style>
